package com.itheima.Work01;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class work01 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<Integer> list = new ArrayList<>();
        Class<? extends ArrayList> clazz = list.getClass();
        Method method = clazz.getMethod("add", Object.class);
       method.invoke(list,"章若楠");
       method.invoke(list,"迪丽热巴");
        for (Object integer : list) {
            System.out.println(integer);
        }


    }
}
